package com.zhang.handler;

import com.zhang.entity.response.ResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created with IntelliJ IDEA.
 * User: 张
 * Date: 2024-10-28
 * Time: 10:39
 * Description:
 */
@RestControllerAdvice
public class GlobalExceptionHandler {
    // 全局异常拦截
    @ExceptionHandler
    public ResponseResult<String> handlerException(Exception e) {
        e.printStackTrace();
        return ResponseResult.error(e.getMessage());
    }
}